home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / hypercrd / xcmds / dvlprstc.hqx / Developer Stack 1.3r / card_30467.txt < prev    next >
Text File  |  1991-04-30  |  4KB  |  117 lines

  1. -- card: 30467 from stack: in.3r
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2612
  5. -- name: BarButton
  6.  
  7.  
  8. -- part 2 (button)
  9. -- low flags: 00
  10. -- high flags: 0002
  11. -- rect: left=183 top=217 right=282 bottom=214
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 0
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: click in me
  20. ----- HyperTalk script -----
  21. on mousedown
  22.   if the optionkey is down then edit script of me
  23.   set cursor to 2
  24.   get the rect of me
  25.   barbutton
  26.   put the result
  27. end mousedown
  28.  
  29.  
  30.  
  31. -- part 3 (button)
  32. -- low flags: 00
  33. -- high flags: 0002
  34. -- rect: left=218 top=256 right=281 bottom=333
  35. -- title width / last selected line: 0
  36. -- icon id / first selected line: 0 / 0
  37. -- text alignment: 1
  38. -- font id: 0
  39. -- text size: 12
  40. -- style flags: 0
  41. -- line height: 16
  42. -- part name: me too
  43. ----- HyperTalk script -----
  44. on mousedown
  45.   if the optionkey is down then edit script of me
  46.   set cursor to 2
  47.   get the rect of me
  48.   barbutton
  49.   put the result
  50. end mousedown
  51.  
  52.  
  53.  
  54. -- part contents for background part 2
  55. ----- text -----
  56. BarButton
  57.  
  58. -- part contents for background part 3
  59. ----- text -----
  60.     The "Bar button" is an easy way for the HyperCard author to ask for numeric values.  It is an XCMD which works a bit like a scroll bar, but you can choose the height, width and direction the bar moves.  You may also specify the range of acceptable values (more on that later.)
  61.  
  62.     Below are two simple Bar buttons.  When you click inside a button, the cursor changes to a thin cross, and the bar moves up to the cursor.  When you release the mouse button, the "value" of the cursor position is returned in "the result".  
  63.  
  64.     Note that the two buttons' scripts are identical, even though one bar moves bottom to top and the other left to right.  The Bar button automatically operates bottom to top if the button's rectangle is taller than it is wide.
  65.  
  66.     Try changing the size or shape of the buttons.  They can be any size, even the whole width of the screen.
  67.  
  68.     If you include at least two parameters,BarButton will normally display the current numeric value as you change the size of the bar.  The value is always displayed to the right of left&right Bar buttons, and below the up&down Bar buttons.
  69.  
  70. You can issue the "BarButton" command at any time; you're not limited to just when a user clicks in the button.  
  71.  
  72. A Public Domain XCMD for Hypercard
  73.  
  74. written by Lloyd Maxfield 
  75.  
  76. Infosynthesis
  77. 2960 Ferry Street
  78. Eugene, OR 97405
  79. (503) 344-3322
  80.  
  81.  
  82.  
  83.  
  84. -- part contents for background part 10
  85. ----- text -----
  86. Syntax: 
  87.  
  88. BarButton [direction][,maximum][,minimum][,default value]
  89.  
  90. You may optionally include up to four parameters after the BarButton command. 
  91.  
  92. The first parameter tells the XCMD to operate the bar in a particular direction:
  93.     1:  left to right
  94.     2:  right to left
  95.     3:  bottom to top
  96.     4:  top to bottom
  97. Using the negatives of these numbers will suppress the numeric value display when specifying the second and third parameters.
  98.  
  99. The second and third parameters after the BarButton command tell the XCMD the range of values you allow.  The second parameter is the maximum, and the third is the minimum.  If the third parameter is absent, zero is assumed.  All values must be integers.
  100.  
  101. The fourth parameter is used when you wish to force an initial value without requiring that the user click in the button.  When you supply this fourth parameter, BarButton displays the initial value and immediately returns, without even looking at the mouse location.
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. -- part contents for background part 13
  112. ----- text -----
  113. 24
  114.  
  115. -- part contents for background part 30
  116. ----- text -----
  117. XCMD